<template>
    <div>
        <van-row class="editor-box-tit background-fff">
            <van-col span="8">
                <img class="center-jt" src="../../assets/image/center/icon_return.png" alt="" @click="toSetting">
            </van-col>
            <van-col span="8" class="text-align-c color-3 font-3 top-title">
                账号绑定
            </van-col>
            <van-col span="8" class="text-align-r color-3 font-2">
                <span class="wancheng"></span>
            </van-col>
        </van-row>
        <div class="ziliao1 clearfix background-fff">
            <ul class="clearfix">
                <router-link tag="li" :to="{ name: 'updatePhone',query:{phone:phone}}">
                    <label class="fl font-3">手机绑定</label>
                    <van-icon class="fr" name="arrow"  color="#a8a7a7"/>
                    <input class="fr text-align-r font-3 phone" type="text" v-model="phone" disabled>
                </router-link>
                <li>
                    <label class="fl font-3">微信绑定</label>
                    <van-switch class="fr vanSwitch" v-model="bindWx" size=".8rem" @input="isSwitch"/>
                </li>
               <!--  <li>
                    <label class="fl font-3">QQ绑定</label>
                    <van-switch class="fr vanSwitch" v-model="qqChecked" size=".8rem" />
                </li> -->
            </ul>
        </div>
    </div>
</template>
<script>
import apiHttp from '../../api/index'
export default {
    data(){
        return{
             wxCode:'', //微信code
             bindWx: this.$route.query.bindWx,
             qqChecked: true,
             isPhone:false,
             phone:this.$route.query.phone
        }
    },
    created(){

    },
    methods:{ 
        //返回setting页面
        toSetting(){
            this.$router.push({
                path:"/setting",
                query:{
                    phone:this.phone,
                    bindWx:this.bindWx
                }
            })
        },       
        isSwitch(){           
            if(this.bindWx==true){
               //取消微信绑定
                apiHttp.apiSetting.dropWechat(params,resp=>{
                    //console.log(resp)
                }) 
            }else{
                //微信绑定
                let params = {        
                    wxCode:this.wxCode   
                }
                apiHttp.apiSetting.getWechat(this.wxCode,params,resp=>{
                    //console.log(resp)
                })                
            }
            
        }
    }
}
</script>

<style scoped>
.zhuanghao-box{
    width: 100%;
    height: 100%;
}
.ziliao1 li {
    height: 1.8rem;
    line-height: 1.8rem;
    color: #333;
    font-size: .52rem;
    border-bottom: #eeeeee solid .02rem;
    padding: 0 .6rem;
}
.van-icon-arrow{
    margin-top: .6rem;
    margin-left: .4rem;
}
.van-switch--on{
    background-color: #D84E4D;
}
.vanSwitch{
    margin-top: .4rem;
}
.phone{
    background-color: #fff;
}
</style>

